

<template>
    <view class="groupMembers">
        <!-- <image
            class="psa"
            style="width:750rpx;height:834rpx;top:0;left:0;right:0;z-index:1;"
            src="../../static/bg1.jpg"
            mode=""
        ></image> -->
        <view
            style="
                background: #fff;
                width: 750rpx;
                position: fixed;
                z-index: 100;
            "
            :style="{ height: systemInfo.statusBarHeight + 'px' }"
        ></view>
        <view
            class="slim_header d-flex a-center j-center"
            style="border-bottom: none"
            :style="{ top: systemInfo.statusBarHeight + 'px' }"
        >
            <view class="left_box" @tap="goBack">
                <image src="/static/center/back.png" class="back"></image>
            </view>
            <view class="title d-flex a-center j-between">发布设置</view>
            <view class="right_box" @tap="finish">
                <text style="color:#333;font-size:30rpx;font-weight:400;">完成</text>
            </view>
        </view>

        <view
            class="content"
            :style="{ top: `calc(  100rpx + ${systemInfo.statusBarHeight}px)` }"
        >
            <view class="row d-flex a-center j-between" @tap="status=1">
                <view class="d-flex a-center">
                    <i class="icon icon-gongkai"></i>
                    公开,所有人可见并出现在附近动态
                </view>
                <i v-if="status===1" style="font-size:40rpx;color:#1DC691;" class="icon icon-xuanzhong"></i>
            </view>
            <view class="row d-flex a-center j-between" @tap="status=2">
                <view class="d-flex a-center">
                    <i class="icon icon-jinhaoyou"></i>
                    仅好友可见
                </view>
                <i v-if="status===2" style="font-size:40rpx;color:#1DC691;" class="icon icon-xuanzhong"></i>
            </view>
            <view class="row d-flex a-center j-between" @tap="status=3">
                <view class="d-flex a-center">
                    <i class="icon icon-quanzi"></i>
                    仅发布到附近动态
                </view>
                <i v-if="status===3" style="font-size:40rpx;color:#1DC691;" class="icon icon-xuanzhong"></i>
            </view>
            <view class="row d-flex a-center j-between" @tap="status=4">
                <view class="d-flex a-center">
                    <i class="icon icon-jinzijikejian"></i>
                    仅自己可见
                </view>
                <i v-if="status===4" style="font-size:40rpx;color:#1DC691;" class="icon icon-xuanzhong"></i>
            </view>
        </view>
    </view>

    <inputArea ref="input_area" :inputText="contentText" @updateText="updateText" @inpFocus="inpFocus" :keyboardHeight="keyboardHeight"></inputArea>
    <imagePreview ref="preview"></imagePreview>
</template>

<script setup lang="ts">
import { ref, computed, reactive,nextTick } from "vue";
import { onReady, onShow, onLoad,onUnload} from "@dcloudio/uni-app";
import { userData as userDataStore } from "@/store/userData";
import { systemInfo as systemInfoStore } from "@/store/systemInfo";
import { releaseTrend } from "@/api/api";
import cacheimg from "@/components/cacheimg.vue";
import { imStore as imStore1 } from "@/store/imStore";
import { wait, showLoading, closeLoading,replaceSwear } from "@/utils/utils";
import { BASE_URL } from "@/api/request";
import inputArea from "@/components/inputArea.vue";
import { position as positionStore } from "@/store/position";
import imagePreview from "@/components/imagePreview.vue";
import { imageConvertArray,getHDImages } from "@/utils/format";
import { updateTrend } from "@/api/api";

const goBack = () => {
    uni.navigateBack();
};

const status = ref(null)
const type = ref(null)
const trendId = ref(null)


const userData: any = userDataStore();
const systemInfo: any = systemInfoStore();

const finish = async()=>{
    if(type.value === 'edit'){
        const res = await updateTrend({id:trendId.value,status:status.value})
        const {flag} = res;
        if(flag!==1){
            uni.showToast({
                icon: "none",
                title: "操作失败,请重试",
                duration: 1500,
            });
            return;
        }

        uni.showToast({
            icon: "success",
            title: "修改成功",
            duration: 1500,
        });

        uni.$emit('statusEditChange',{id:trendId.value,status:status.value});
        goBack();
        return

    }
    uni.$emit('statusChange',status.value);
    goBack();
}



onReady(() => {});

onLoad((option: any) => {
    status.value = Number(option.status);
    type.value = option.type;
    trendId.value = option.id;

});

onUnload((option: any) => {
});

onShow(() => {});
</script>

<style lang="scss" scoped>
.groupMembers {
    width: 750rpx;
    height: 100vh;
    background: #fff;

    .content {
        position: absolute;
        width: 750rpx;
        left: 0;
        right: 0;
        // bottom: calc(constant(safe-area-inset-bottom) + 120rpx);
        // bottom: calc(env(safe-area-inset-bottom) + 120rpx);
        bottom: 0;
        background: #f5f5f5;

        .row{
            width:710rpx;
            height:80rpx;
            margin:0 auto;
            margin-top:20rpx;
            background:#fff;
            border-radius: 20rpx;
            padding:0 20rpx;
            color:#333;
            font-size:30rpx;
            .icon{
                margin-right:5rpx;
                font-size:40rpx;
            }
        }

    }
}
</style>
